<?php
require '../../../zb_system/function/c_system_base.php';
require '../../../zb_system/function/c_system_admin.php';
$zbp->Load();
$action='root';
if (!$zbp->CheckRights($action)) {$zbp->ShowError(6);die();}
if (!$zbp->CheckPlugin('AliyunOSS')) {$zbp->ShowError(48);die();}

$blogtitle='阿里云存储';
require $blogpath . 'zb_system/admin/admin_header.php';
?>
<link rel="stylesheet" type="text/css" href="style.css"/>
<?php
require $blogpath . 'zb_system/admin/admin_top.php';
?>
<div id="divMain">
  <div class="divHeader"><?php echo $blogtitle;?></div>
  <div class="SubMenu">
		<a href="main.php" ><span class="m-left">阿里云账户</span></a>
		<a href="Watermark.php" ><span class="m-left">水印设置</span></a>
		<a href="thumbnail.php" ><span class="m-left">缩略图设置</span></a>
		<a href="https://me.alipay.com/zrcs" target="_blank"><span class="m-left" style="color:#F00">赞助</span></a>
    <a href="http://www.fengwensheng.com/" target="_blank"><span class="m-right">帮助</span></a>
  </div>
  <div id="divMain2">
<!--代码-->

    <?php
	if(isset($_POST['access_id'])){
		$zbp->Config('AliyunOSS')->access_id=$_POST['access_id'];
		$zbp->Config('AliyunOSS')->access_key=$_POST['access_key'];
		$zbp->Config('AliyunOSS')->default_host=$_POST['default_host'];
		$zbp->Config('AliyunOSS')->object_url=$_POST['object_url'];
		$zbp->Config('AliyunOSS')->object_cate=$_POST['object_cate'];
		$zbp->Config('AliyunOSS')->bucket=$_POST['bucket'];
		$zbp->SaveConfig('AliyunOSS');
		$zbp->SetHint('good');
		Redirect('./main.php');
	}
	?>

    <form id="form-postsubmit" name="form-postsubmit" method="post" action="main.php">
      <table width="100%" style="padding:0px;margin:0px;" cellspacing="0" cellpadding="0" class="tableBorder">
        <tr>
          <th width="30%"><p align="center">设置</p></th>
          <th width="60%"><p align="center">内容</p></th>
        </tr>
        <tr>
          <td><p><b>· OSS Endpoint</b><br/>
              <span class="note">&nbsp;如果您使用阿里云ECS或者其他内网互通服务器可选择内网通信</span></p></td>
          <td>

          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-qingdao.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-qingdao.aliyuncs.com'):?>checked="checked"<?php endif;?> />青岛外网</label>
          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-qingdao-internal.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-qingdao-internal.aliyuncs.com'):?>checked="checked"<?php endif;?> />青岛内网</label>

          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-hangzhou.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-hangzhou.aliyuncs.com'):?>checked="checked"<?php endif;?> />杭州外网</label>
          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-hangzhou-internal.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-hangzhou-internal.aliyuncs.com'):?>checked="checked"<?php endif;?> />杭州内网</label>

          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-beijing.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-beijing.aliyuncs.com'):?>checked="checked"<?php endif;?> />北京外网</label>
          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-beijing-internal.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-beijing-internal.aliyuncs.com'):?>checked="checked"<?php endif;?> />北京内网</label>

          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-xianggang.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-xianggang.aliyuncs.com'):?>checked="checked"<?php endif;?> />香港外网</label>
          	<label><input type="radio" name="default_host" id="radio" value="oss-cn-xianggang-internal.aliyuncs.com" <?php if($zbp->Config('AliyunOSS')->default_host=='oss-cn-xianggang-internal.aliyuncs.com'):?>checked="checked"<?php endif;?> />香港内网</label>
          </td>
        </tr>
        <tr>
          <td><p><b>· Access Token</b><br/>
              <span class="note">&nbsp;如果您没有阿里云Access Token的话，可以点击<a href="https://portal.qiniu.com/setting/key" target="_blank">https://i.aliyun.com/access_key/</a>这里去获取。</span></p></td>
          <td><input type="text" id="access_id" name="access_id" value="<?php echo $zbp->Config('AliyunOSS')->access_id?>" /></td>
        </tr>
        <tr>
          <td><p><b>· Secret Key</b><br/>
              <span class="note">&nbsp;如果您没有阿里云Secret Key的话，可以点击<a href="https://portal.qiniu.com/setting/key" target="_blank">https://i.aliyun.com/access_key/</a>这里去获取。</span></p></td>
          <td><input type="password" id="access_key" name="access_key" value="<?php echo $zbp->Config('AliyunOSS')->access_key?>" /></td>
        </tr>
        <tr>
          <td><p><b>· 空间名</b><br/>
              <span class="note">&nbsp;待存储数据的空间名（必须为公开）</p></td>
          <td><input type="text" id="bucket" name="bucket" value="<?php echo $zbp->Config('AliyunOSS')->bucket?>" /></td>
        </tr>
        <tr>
          <td><p><b>· 上传目录</b><br/>
              <span class="note">&nbsp;若为根目录请留空；前面不需要加“/”，且最后一位必须为“/”。</p></td>
          <td><input type="text" id="object_cate" name="object_cate" value="<?php echo $zbp->Config('AliyunOSS')->object_cate?>" /></td>
        </tr>
        <tr>
          <td><p><b>· 绑定域名</b><br/>
              <span class="note">&nbsp;如果您要使用<?php echo OSS_OBJECT_URL1?>，请留空。</p></td>
          <td><input type="text" id="object_url" name="object_url" value="<?php echo $zbp->Config('AliyunOSS')->object_url?>" /></td>
        </tr>
      </table>
      <br />
      <input name="" type="submit" class="button" value="保存"/>
    </form>

  </div>
</div>

<script type="text/javascript">AddHeaderIcon("<?php echo $bloghost . 'zb_users/plugin/AliyunOSS/logo.png';?>");</script>
<script type="text/javascript">
ActiveTopMenu("topmenu_AliyunOSS");
</script> 
<?php
require $blogpath . 'zb_system/admin/admin_footer.php';
RunTime();
?>